package com.Stream流;

/*
* Stream流的常见生成方式
	Collection体系的集合可以使用默认方法stream（）生产流
        default Stream<E> stream()
	Map体系的集合间接生产流
	数组可以通过Stream接口的静态方法of(T...values)生成流
* */

import java.util.*;
import java.util.stream.Stream;

public class StreamDemo_生成流 {
    public static void main(String[] args) {
        //Collection体系的集合可以使用默认方法stream（）生产流
        List<String> list = new ArrayList<String>();
        Stream<String> liststream = list.stream();

        Set<String> set = new HashSet<String>();
        Stream<String> setStream = set.stream();

        //Map体系的集合间接生产流
        Map<String, Integer> map = new HashMap<String, Integer>();
        Stream<String> keyStream = map.keySet().stream();
        Stream<Integer> valueStream = map.values().stream();
        Stream<Map.Entry<String, Integer>> entryStream = map.entrySet().stream();

        //数组可以通过Stream接口的静态方法of(T...values)生成流
        String[] array = {"hello","world","java"};
        Stream<String> strArrayStream = Stream.of(array);
        Stream<String> strArrayStream01 = Stream.of("hello","world","java");
        Stream<Integer> integerStream = Stream.of(10, 20, 30);
    }
}
